//自主飞行、变质量选择

import {ref,computed} from 'vue';
import { useVarChooseStore } from '@/store/varChoose'
import { storeToRefs } from "pinia";

export default function useConfigFile() {
const varChooseStore = useVarChooseStore()
const { jsonMsg } = storeToRefs(varChooseStore)
const checkedItems_4 = ref<any>([]);    //多选框-2
const popoverVisible_4 = ref(false);      // 控制 Popover 显示/隐藏 ---多选框
const options_4 = computed(() => jsonMsg.value?.sequence[3]?.items ?? [])
// 确认选择
const confirmSelection_4 = () => {
    console.log('选中的值：', checkedItems_4.value);
    popoverVisible_4.value = false;
};

//输入框
const handleInputChange_4 = (value: any) => {
    console.log('当前输入值:', value);
};

// 处理全选/取消全选
const handleCheckAllChange_4 = (val: any, item: any) => {
    item.default = val ? item.editor.options.map((opt: any) => opt.value) : []
    item.indeterminate = false
}

// 处理选项变化
const handleSelectChange_4 = (item: any) => {
    const checkedCount = item.default.length
    item.checkAll = checkedCount === item.editor.options.length
    item.indeterminate = checkedCount > 0 && checkedCount < item.editor.options.length
}


return {checkedItems_4,popoverVisible_4,options_4,confirmSelection_4,handleInputChange_4,handleCheckAllChange_4,handleSelectChange_4}

}